package com.liit.module.service.impl;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.liit.module.dao.AccountDao;
import com.liit.module.entity.Account;
import com.liit.module.frame.utils.page.Pagination;
import com.liit.module.service.AccountService;

/**
 * @author dingweibo
 * @Title: AccountServiceImpl.java
 * @Description: TODO(用一句话描述该文件做什么)
 * @date 2015年11月28日
 */
@Service("accountService")
public class AccountServiceImpl implements AccountService {
	@Resource
	private AccountDao accountDao;

	@Override
	public Integer saveAccount(Account entity) throws Exception {
		return accountDao.saveAccount(entity);
	}

	@Override
	public Integer updateAccountById(Account entity) throws Exception {
		return accountDao.updateAccountById(entity);
	}

	@Override
	public Account selectAccountById(Long id) throws Exception {
		return accountDao.selectAccountById(id);
	}

	@Override
	public Account selectByUsername(String username) {
		return accountDao.selectByUsername(username);
	}

	@Override
	public Map<String, Object> listPage(Account account, Pagination pagination) {
		Map<String, Object> result = new HashMap<String, Object>();
		result.put("list", accountDao.listPage(account, pagination));
		result.put("page", pagination);
		return result;
	}

	@Override
	public Set<String> findPermissions(String username) {
		return accountDao.findPermissions(username);
	}
}
